<?php 
header('Content-Type: application/json');
require "global_conn.php";
$request = $_REQUEST;
$data = array();
if(count($request['data']) == 0){
	callProcedure("DELETE FROM  geos WHERE area_id='".$request['area']."'");
	echo @json_encode($data);
	
	exit();
}
if(!empty($request['data'])){
	callProcedure("DELETE FROM  geos WHERE area_id='".$request['area']."'");
	
	foreach($request['data'] as $key=>$value){
		
		$latitude = $value['lat'];
		$longtitude = $value['lng'];
		callProcedure("INSERT INTO geos (latitude,longtitude,datetime,area_id) VALUES ('$latitude', '$longtitude', '".time()."','".$request['area']."')");
	}
	
}
echo @json_encode($data);


?>